/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistence;

import java.io.Serializable;
import persistence.dao.mysql.POIDAO;
import persistence.dao.mysql.TagDAO;
import persistence.dao.mysql.TypeDAO;
import persistence.entites.Type;
import persistence.factory.AbstractDAOFactory;
import persistence.factory.DAOType;

/**
 *
 * @author Vanessa de Bernard
 */
public class ConnectionMySQL implements Serializable {

    private static ConnectionMySQL connMySQL;
    private AbstractDAOFactory adf = null;
    private POIDAO poiDAO = null;
    private TypeDAO typeDAO = null;
    private TagDAO tagDAO = null;

    private ConnectionMySQL() {
        adf = AbstractDAOFactory.getFactory(DAOType.MYSQL);
        adf.createConnection(null);
        poiDAO = adf.getPOIDAO();
        typeDAO = adf.getTypeDAO();
        tagDAO = adf.getTagDAO();
    }

    public AbstractDAOFactory getAdf() {
        return adf;
    }

    public static ConnectionMySQL getConnMySQL() {
        if (connMySQL == null) {
            connMySQL = new ConnectionMySQL();
        }
        return connMySQL;
    }

    public POIDAO getPoiDAO() {
        return poiDAO;
    }

    public TagDAO getTagDAO() {
        return tagDAO;
    }

    public TypeDAO getTypeDAO() {
        return typeDAO;
    }

    public static void main(String[] args){
        ConnectionMySQL.getConnMySQL();
    }
}
